/*  1:   */package com.java.diagnostics.visualizer.recommender.occupancy;
/*  2:   */
/*  3:   */import com.java.diagnostics.visualizer.data.AggregateData;
/*  4:   */import com.java.diagnostics.visualizer.data.TupleData;
/*  5:   */import com.java.diagnostics.visualizer.gc.recommender.RecommendationPreferenceHelper;
/*  6:   */import com.java.diagnostics.visualizer.recommender.Recommendation;
/*  7:   */import com.java.diagnostics.visualizer.recommender.RecommendationBase;
/*  8:   */import com.java.diagnostics.visualizer.recommender.util.Messages;
/*  9:   */
/* 21:   */public class NurseryOccupancyRecommendation
/* 22:   */  extends RecommendationBase
/* 23:   */  implements Recommendation
/* 24:   */{
/* 25:   */  public void recommend(AggregateData data)
/* 26:   */  {
/* 27:27 */    Object gcMode = getGCMode(data);
/* 28:28 */    if ("gencon".equals(gcMode)) {
/* 29:29 */      TupleData occupancy = data
/* 30:30 */        .getTupleData("VGCLabels.live.nursery.heap.after.gc");
/* 31:   */      
/* 32:32 */      if (occupancy != null) {
/* 33:33 */        int meanOccupancy = getMeanAsPercent(occupancy);
/* 34:   */        
/* 35:35 */        if (meanOccupancy > this.helper.getHighOccupancyThreshold())
/* 36:   */        {
/* 37:37 */          String string = 
/* 38:38 */            Messages.getString(
/* 39:39 */            "high.nursery.occupancy.message", new Object[] { Integer.valueOf(meanOccupancy) });
/* 40:40 */          addWarning(data, string);
/* 41:   */          
/* 42:42 */          TupleData nurserySize = data
/* 43:43 */            .getTupleData("VGCLabels.nursery.size");
/* 44:44 */          int increase = meanOccupancy / 60;
/* 45:45 */          int meanNurserySize = 
/* 46:46 */            (int)Math.round(getMeanAsMB(nurserySize));
/* 47:   */          
/* 48:48 */          int suggestedNurserySize = meanNurserySize * increase;
/* 49:   */          
/* 50:50 */          addToCommandLine(data, "-Xmn", "-Xmn" + 
/* 51:51 */            suggestedNurserySize + "m");
/* 52:   */        }
/* 53:   */      }
/* 54:   */    }
/* 55:   */  }
/* 56:   */}


